package first;


import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.TreeMap;

public class Test {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		String t="2001-10-11 21:34 -0400";
		String t2="2001-10-3 21:34 -0400";
		long a = 979176840;
		long b = 979263240;
		System.out.println(b-a);
		
		java.text.SimpleDateFormat sdf= new SimpleDateFormat("yyyy-mm-dd HH:mm Z");
		Calendar cal=java.util.Calendar.getInstance();
		Date date=null;
		try {
			date = sdf.parse(t);
		} catch (ParseException e) {
			e.printStackTrace();
		}
		System.out.println(date);
		System.out.println(date.getTime());
		cal.setTime(date);
		System.out.println(cal);
		int res = compareDate(t,t2);
		
		Integer d=1;
		Integer c=2;
		System.out.println(c-d);
		if(1<=3){
			System.out.println("yes");
		}
		
		List<Long> array=new ArrayList<Long>();
		array.add(1l);
		array.add(5l);
		array.add(4l);
		array.add(2l);
		array.add(3l);
		System.out.println(array);
		java.util.Collections.sort(array);
		System.out.println(array);
		
		int[] aa={0,2,3,1,4};
		for(int i=0;i<aa.length;i++)
			System.out.println(aa[i]);
		treeSetsort();
		
		
	}

	public static int compareDate (String DATE1,String DATE2){
		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd hh:mm"); 
        try { 
            Date dt1 = df.parse(DATE1); 
            Date dt2 = df.parse(DATE2); 
            System.out.println(dt1.getTime());
            if (dt1.getTime() > dt2.getTime()) { 
                System.out.println("dt1 在dt2前"); 
                return 1; 
            } else if (dt1.getTime() < dt2.getTime()) { 
                System.out.println("dt1在dt2后"); 
                return -1; 
            } else { 
                return 0; 
            } 
        } catch (Exception exception) { 
            exception.printStackTrace(); 
        } 
        return 0; 
    } 
	public static void treeSetsort(){
		TreeMap<String, String> sPara = new TreeMap<String, String>();
	    sPara.put("abc", "abc");
	    sPara.put("cds", "cds");
	    sPara.put("ads","ads");
	    sPara.put("fff", "fff");
	    sPara.put("ccc", "ccc");
	    sPara.put("ddd", "ddd");
	    sPara.put("qqqqq", "qqqqq");
	    sPara.put("knns", "knns");
	    sPara.put("ioio", "ioio");
	    Set<String> keys = sPara.keySet();
	    for (String key : keys){
	        System.out.println(key);
	    }
	}
}
